﻿using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;

namespace LabMS.Web.Equipment.LowValue
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class GetStatus : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Request != null&&context.Request["Code"]!=null)
            {
                string strCode = context.Request["Code"].ToString();
                LabMS.BLL.InstrumentAndConsumables binstrument
                    = new LabMS.BLL.InstrumentAndConsumables();
                List<LabMS.Model.InstrumentAndConsumables> listInstrument
                    = new List<LabMS.Model.InstrumentAndConsumables>();
                ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
                List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();


                listInstrument = binstrument.GetModelList("Numbers = '" + strCode+"'");
                if (listInstrument.Count < 0)
                {
                    return;
                }

                listCClass = eDictionary.GetModelList("Code='" + listInstrument[0].Status + "'");
                if (listCClass.Count < 0)
                {
                    return;
                }


                context.Response.ContentType = "application/json";
                context.Response.Write("{result: '" +listCClass[0].Name+ "'}");


            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
